/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bsc.war.test;

import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.dom4j.Document;
import org.springframework.web.servlet.view.AbstractView;

/**
 *
 * @author luisZavaleta
 */
public class XmlView extends AbstractView{

    private final Document _xml;

  public XmlView(final Document xml) {
    _xml = xml;
  }

    @Override
    protected void renderMergedOutputModel(Map map, HttpServletRequest request, HttpServletResponse response) throws Exception {
            response.setContentType("application/xml");
            response.setCharacterEncoding("UTF-8");

            response.getOutputStream().print(_xml.asXML());

    }

}


/*
 public class XMLView extends AbstractView {

  private final Document _xml;

  public XMLView(final Document xml) {
    _xml = xml;
  }

  @Override
  protected void renderMergedOutputModel(final Map<String, Object> model, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
   
    // do stuff to serialize _xml to response.getOutputStream()
   }
}



 */